import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 会员等级设定信息 */
export interface VipLevel {
          id: number; // 会员等级ID
          levelName?: string; // 等级名称
          duration: string; // 会员时长
          price: number; // 会员价格
          vipRights: string; // 会员权益说明
          status: boolean; // 会员启用状态（0-未启用，1-已启用）
  }

// 会员等级设定 API
export const VipLevelApi = {
  // 查询会员等级设定分页
  getVipLevelPage: async (params: any) => {
    return await request.get({ url: `/train/vip-level/page`, params })
  },

  // 查询会员等级设定详情
  getVipLevel: async (id: number) => {
    return await request.get({ url: `/train/vip-level/get?id=` + id })
  },

  // 新增会员等级设定
  createVipLevel: async (data: VipLevel) => {
    return await request.post({ url: `/train/vip-level/create`, data })
  },

  // 修改会员等级设定
  updateVipLevel: async (data: VipLevel) => {
    return await request.put({ url: `/train/vip-level/update`, data })
  },

  // 删除会员等级设定
  deleteVipLevel: async (id: number) => {
    return await request.delete({ url: `/train/vip-level/delete?id=` + id })
  },

  /** 批量删除会员等级设定 */
  deleteVipLevelList: async (ids: number[]) => {
    return await request.delete({ url: `/train/vip-level/delete-list?ids=${ids.join(',')}` })
  },

  // 导出会员等级设定 Excel
  exportVipLevel: async (params) => {
    return await request.download({ url: `/train/vip-level/export-excel`, params })
  },

  // 获得所有会员等级
  getAllVipLevel: async () => {
    return await request.get({ url: `/train/vip-level/allLevel` })
  }
}
